package com.example.administrator.znjt.bean;

import com.example.administrator.znjt.adapter.EnvironmentalAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/5/11.
 */

public class DataStack extends ArrayList<EnvironmentalAdapter.Bean> {
    public static  final  int MAX_SIZE = 12;

    public boolean push(EnvironmentalAdapter.Bean o){
        if(size() >= MAX_SIZE){
           return false;
        }
        return  super.add(o);
    }

    public int getLastItemPosition(){
        int position = size() - 1;
        return position < 0 ? 0 : position;
    }

    public EnvironmentalAdapter.Bean pop(){
        return remove(getLastItemPosition());
    }
}
